   box=document.querySelector('.banner');
    var left = document.querySelector('.zuo');
var right = document.querySelector('.you');
//获取所有轮播按钮
var button_li=document.getElementById("button").getElementsByTagName("li");
//获取所有banner图
var pic_img=document.getElementById("banner_pic").getElementsByTagName("img");
   box.addEventListener('mouseover',function(){
    left.style.display="block";
    right.style.display ='block';
})
box.addEventListener('mouseout',function(){
    left.style.display="none";
    right.style.display ='none';
     //timer;
})
 var current_index=0;
function autoChange(type){
    button_li[current_index].className="but";
    pic_img[current_index].className="pic";
if (type===true){
    current_index++;
    
    }else if(type===false){
        current_index--;
        }else{
                current_index=type; 
             }
    if (current_index>pic_img.length-1){
        current_index=0;
        } 
    if (current_index<0){
            current_index=pic_img.length-1;
            } 
        button_li[current_index].className="current";
        pic_img[current_index].className="current";
        }
        
//1000表示调用周期，以毫秒为单位，1000毫秒就是1秒
     var timer=setInterval(function(){autoChange(true);},4000);
    box.onclick=function(e){
         if(timer){
             clearInterval(timer);
         }
        if(e.target.className==="zuo"){
            autoChange(false);
            }
    if(e.target.className==="you"){ //console.log("657643");
        autoChange(true);
        }
    if(e.target.dataset.name==="point"){
        var i=e.target.dataset.index;
        autoChange(i);
        }	
        }
     // 平滑滚动导航功能
    const navLinks = document.querySelectorAll('.right-navbar a');
    const sections = document.querySelectorAll('.pindao');
    const headerHeight = 80; // 导航栏高度
    
    // 平滑滚动到指定区域
    function scrollToSection(targetId) {
        const targetElement = document.getElementById(targetId);
        if (targetElement) {
            window.scrollTo({
                top: targetElement.offsetTop - headerHeight,
                behavior: 'smooth'
            });
        }
    }
    
    // 更新导航高亮
    function updateNavHighlight() {
        const scrollY = window.scrollY || window.pageYOffset;
        let currentSectionId = '';
        
        sections.forEach(section => {
            const sectionTop = section.offsetTop - headerHeight - 50;
            const sectionBottom = sectionTop + section.offsetHeight;
            
            if (scrollY >= sectionTop && scrollY < sectionBottom) {
                currentSectionId = section.id;
            }
        });
        
        // 更新导航高亮
        navLinks.forEach(link => {
            const href = link.getAttribute('href').substring(1);
            link.classList.toggle('current', href === currentSectionId);
        });
    }
    
    // 绑定导航点击事件
    navLinks.forEach(link => {
        link.addEventListener('click', (e) => {
            e.preventDefault();
            const targetId = link.getAttribute('href').substring(1);
            scrollToSection(targetId);
        });
    });
    
    // 监听滚动事件更新导航高亮
    window.addEventListener('scroll', updateNavHighlight);
    
    // 初始检查导航高亮
    updateNavHighlight();
